{extend name="public/base"/}
{block name="style"}

<link rel="stylesheet" href="__PUBLIC__/plugs/tagsinput/bootstrap-tagsinput.css">
<script src="__PUBLIC__/plugs/tagsinput/bootstrap-tagsinput.js"></script>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/webuploader/webuploader.css">
<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__/plugs/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__/plugs/ueditor/ueditor.all.min.js"></script>
<!-- datepicker statr -->
<link href="__PUBLIC__/plugs/datepicker/css/foundation-datepicker.min.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/board/board.min.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/layui/css/layui.css" />
<!-- datepicker end -->
{/block}
{block name="body"}
<div class="main-box clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>{$meta_title}</h2>
		</div>
	</header>
	<div class="main-box-body clearfix">
		<form method="post" class="form form-horizontal">
			<input type="hidden" name="uid" value="{$info.uid}">

			<div class="form-group">
				<label class="col-lg-2 control-label">员工姓名</label>
				<div class="col-lg-6 col-sm-6">
					<input type="text" class="form-control" name="username" id="username" value="{$info.username}" autocomplete="false" readonly="">
					<div class="help-block"></div>
				</div>
			</div>
			<!--
			<div class="form-group">
				<label class="col-lg-2 control-label">昵称</label>
				<div class="col-lg-10 col-sm-10">
					<input type="text" class="form-control" name="nickname" id="nickname" autocomplete="false" value="">
					<div class="help-block"></div>
				</div>
			</div>
			-->
			<div class="form-group">
				<label class="col-lg-2 control-label">密码</label>
				<div class="col-lg-6 col-sm-6">
					<input type="password" class="form-control" name="password" id="password" autocomplete="false" value="">
					<div class="help-block">为空时则不修改</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">手机号码</label>
				<div class="col-lg-6 col-sm-6">
					<input type="text" class="form-control" name="mobile" id="mobile" autocomplete="false" value="{$info.mobile!=0??''}" placeholder="请填写电话号码">
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">生日日期</label>
				<div class="col-lg-6 col-sm-6">
					<input type="text" class="form-control"  name="birthday" id="birthday" placeholder="yyyy-MM-dd" value="{$info.birthday!=0??''}">
					<!-- <input type="date" class="form-control" name="birthday" id="birthday" autocomplete="false"  > -->
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">邮箱</label>
				<div class="col-lg-6 col-sm-6">
					<input type="text" class="form-control" name="email" id="email" autocomplete="false" value="{$info.email}">
					<div class="help-block">用户邮箱，用于找回密码等安全操作</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">QQ</label>
				<div class="col-lg-6 col-sm-6">
					<input type="text" class="form-control" name="qq" id="qq" autocomplete="false" value="{$info.qq}" placeholder="请填写常用QQ号">
					<div class="help-block"></div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-lg-2 control-label">部门</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control col-lg-6 col-sm-6" name="group" id="group" style="width:100%;" >
						<option value="">请选择部门</option>
						{foreach name="grouplist" item="vo" key="k" }
						<option value="{$k}" {if $info.group==$k}selected {/if} >{$vo}</option>
						{/foreach}
					</select>
				</div>
			</div>

			<div class="form-group">
				<label class="col-lg-2 control-label">我的上级</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control" name="pid" id="pid" style="width:100%;">
						<option value="{$info.pid}">{$members[$info['pid']] ?? '无上级'}</option>
					</select>
					<div class="help-block">员工上级</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">岗位</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control" name="situation" id="situation" style="width:100%;">
						<!-- <option value="0">请选择岗位</option>
						{foreach name="situation" item="vo" key="k" }
						<option value="{$k}" {if $info.situation==$k}selected {/if}>{$vo}</option>
						{/foreach} -->
						<option value="{$info.situation}">{$situation[$info['situation']] ?? '无岗位'}</option>
					</select>
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">等级</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control" name="gradation" id="gradation" style="width:100%;">
						<option value="0" {if $info.gradation==0}selected {/if}>请选择</option>
						<option value="1" {if $info.gradation==1}selected {/if}>P1</option>
						<option value="2" {if $info.gradation==2}selected {/if}>P2</option>
						<option value="3" {if $info.gradation==3}selected {/if}>P3</option>
						<option value="4" {if $info.gradation==4}selected {/if}>P4</option>
						<option value="2" {if $info.gradation==5}selected {/if}>P5</option>
						<option value="3" {if $info.gradation==6}selected {/if}>P6</option>
						<option value="4" {if $info.gradation==7}selected {/if}>P7</option>
					</select>
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">学历</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control" name="schooling" id="schooling" style="width:100%;">
						<option value="0" {if $info.schooling==0}selected {/if}>未知</option>
						<option value="1" {if $info.schooling==1}selected {/if}>小学</option>
						<option value="2" {if $info.schooling==2}selected {/if}>初中</option>
						<option value="3" {if $info.schooling==3}selected {/if}>高中</option>
						<option value="4" {if $info.schooling==4}selected {/if}>大专</option>
						<option value="5" {if $info.schooling==5}selected {/if}>本科</option>
						<option value="6" {if $info.schooling==6}selected {/if}>研究生</option>
						<option value="7" {if $info.schooling==7}selected {/if}>博士</option>
					</select>
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">工作状态</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control" name="job_status" id="job_status" style="width:100%;">
						<option value="0" {if $info.job_status==0}selected {/if}>试用期</option>
						<option value="1" {if $info.job_status==1}selected {/if}>录取期</option>
						<option value="2" {if $info.job_status==2}selected {/if}>已离职</option>
					</select>
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">擅长</label>
				<div class="col-lg-6 col-sm-6">
					<textarea class="form-control" name="hobby" id="hobby" style="width:100%;" placeholder="请填写擅长例如：百度文案，虐文，宠文">{$info.hobby}</textarea>
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">其他技能</label>
				<div class="col-lg-6 col-sm-6">
					<textarea class="form-control" name="other_skills" id="other_skills" style="width:100%;" placeholder="请填写其他技能例如：PS美工，驾照，英语4级">{$info.other_skills}</textarea>
					<div class="help-block"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">获奖或荣誉</label>
				<div class="col-lg-6 col-sm-6 honour">
					{foreach name="userhonour" item="vo" key="k" }
					<div id="{$vo.id}">
					<div  style=" display: flex;flex-direction: row;">
						<input type="hidden" name="honour['{$vo.id}'][honour_id]" id="honour_id" value="{$vo.id}">
						<input type="date" class="form-control" name="honour['{$vo.id}'][honour_time]" id="honour_time" autocomplete="false" value="{$vo.honour_time_text}"  style="width:20%;" ><label class="col-lg-0 control-label">-</label>
						<input type="text" class="form-control" name="honour['{$vo.id}'][honour_title]" id="honour_title" autocomplete="false" value="{$vo.honour_title}" placeholder="请填写荣誉名称" style="width:20%;" ><label class="col-lg-0 control-label">-</label>
						<input type="text" class="form-control" name="honour['{$vo.id}'][honour_content]" id="honour_content" autocomplete="false" value="{$vo.honour_content}" placeholder="请填写荣誉内容" style="width:60%;" >
					</div>
					<div class="help-block"><button  class="btn btn-del honour_btn" type="button" onclick="honourdel('{$vo.id}',1)">删除</button></div>
					</div>
					{/foreach}
				</div>
				<button style="display: block; margin: 1px;" class="btn btn-info honour_btn" type="button" onclick="honour()">添加</button>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">性别</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control" name="sex" id="sex" style="width:100%;">
						<option value="0" {if $info.sex==0}selected {/if}>保密</option>
						<option value="1" {if $info.sex==1}selected {/if}>男</option>
						<option value="2" {if $info.sex==2}selected {/if}>女</option>
					</select>
					<div class="help-block"></div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-lg-2 control-label">地址</label>
				<div class="col-lg-6 col-sm-6">
					<div data-toggle="distpicker" style="display: flex;" id="distpickerlist">
						<select class='selectpicker  form-control' name="province" id="province"
							data-province="{$info.province}" style="margin: 0 2px;"></select>
						<select class='selectpicker  form-control' name="city" id="city" data-city="{$info.city}"
							style="margin: 0 2px;"></select>
						<select class='selectpicker  form-control' name="area" id="area" data-district="{$info.area}"
							style="margin: 0 2px;" ></select>
					</div>
					<input type="hidden" name="province_code" id="province_code"  value="{$info.province_code}">
					<input type="hidden" name="city_code" id="city_code" value="{$info.city_code}">
					<input type="hidden" name="area_code" id="area_code"  value="{$info.area_code}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">详细地址</label>
				<div class="col-lg-6 col-sm-6">
					<input type="text" class="form-control" name="address" id="address" autocomplete="false"
						value="{$info.address}" placeholder="请输入详细地址">
					<div class="help-block">详细地址可以不用带省市区</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-lg-2 control-label">状态</label>
				<div class="col-lg-6 col-sm-6">
					<select class="form-control" name="status" id="status" style="width:100%;">
						<option value="0" {if $info.status==0}selected {/if>禁用</option>
						<option value="1" {if $info.status==1}selected {/if}>启用</option>
					</select>
					<div class="help-block"></div>
				</div>
			</div>

			<div class="form-group">
				<div class="col-lg-offset-2 col-lg-10">
					<input type="hidden" name="id" value="{$info['id']|default=''}">
					<button class="btn btn-success submit-btn ajax-post" type="submit" target-form="form-horizontal">确 定</button>
					<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
				</div>
			</div>
		</form>
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.custom.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/droppable.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/board/board.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/layer/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/layui/layui.js" ></script>
<script src="__PUBLIC__/plugs/distpicker/js/distpicker.data.js"></script>
<script src="__PUBLIC__/plugs/distpicker/js/distpicker.js"></script>
<script>
	layui.use('laydate', function(){
	var laydate = layui.laydate;
	
	//常规用法
	laydate.render({
	elem: '#birthday'
	});
});
</script>
<script type="text/javascript">
$(function(){
	var uid = {$Think.session.user_auth.uid};
	$('#group').on('change',function () {
		var value = $(this).val();
		console.log(value);
		if (value==3)
		{
			$('.form-horizontal').prepend('<input type="hidden" name="is_top" value="1">');
		}else{
			$('.form-horizontal').prepend('<input type="hidden" name="s_uid" value="'+uid+'">');
		}
	});
})
function honour(){
	var html='	<div id="'+Date.now()+'"><div style="display: flex;flex-direction: row;">';
		html+='<input type="hidden" name="honour['+Date.now()+'][honour_id]" value="">';
		html+='<input type="date" class="form-control" name="honour['+Date.now()+'][honour_time]" id="honour_time" autocomplete="false" value=""  style="width:20%;" ><label class="col-lg-0 control-label">-</label>';
		html+='<input type="text" class="form-control" name="honour['+Date.now()+'][honour_title]" id="honour_title" autocomplete="false" value="" placeholder="请填写荣誉名称" style="width:20%;" ><label class="col-lg-0 control-label">-</label>';
		html+='<input type="text" class="form-control" name="honour['+Date.now()+'][honour_content]" id="honour_content" autocomplete="false" value="" placeholder="请填写荣誉内容" style="width:60%;" >';
		html+='</div><div class="help-block"><button  class="btn btn-del honour_btn" type="button"  onclick="honourdel('+Date.now()+',2)">删除</button></div></div>';

	$('.honour').append(html);
}
function honourdel(id,type){
	layer.open({
			type: 0,
            title: '提示',
            content: '是否确定删除,删除后不可恢复!',
			area:["20%","30%"],
			btn: ['确定', '取消'],
			btnAlign: 'c',
			yes: function(index, layero){
				//按钮【按钮一】的回调
				if(type==1){
					$.ajax({
						url:'',
						type:'POST',
						data:{
							id:id
						},
						success: function (res) {
						}
					});
				}
				$('#'+id).remove();
				layer.close(index);
			}
        });
}
$("#province").on("change", function() {
			var provincepicker = $('#province option:selected').data('code');
			$("#province_code").val(provincepicker);
			var citypicker = $('#city option:selected').data('code');
			$("#city_code").val(citypicker);
			var areapicker = $('#area option:selected').data('code');
			$("#area_code").val(areapicker);
		});
		$("#city").on("change", function() {
			var citypicker = $('#city option:selected').data('code');
			$("#city_code").val(citypicker);
			var areapicker = $('#area option:selected').data('code');
			$("#area_code").val(areapicker);
		});
		$("#area").on("change", function() {
			var areapicker = $('#area option:selected').data('code');
			$("#area_code").val(areapicker);
		});
</script>
{include file="user/_select_member_group" /}
{/block}